﻿using Anke.SHManage.MSSQLDAL;
using Microsoft.Reporting.WebForms;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace Anke.SHManage.Web.Reports
{
    public partial class TJ_DoctorInvoiceConditionWebForm : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                this.ReportViewer1.LocalReport.EnableHyperlinks = true;
                Data_Binding();
            }
        }

        private void Data_Binding()
        {
            //获取本页路径，截取虚拟路径， 作为参数传递给需跳转页面作为URL
            string req_url = this.Request.Url.ToString();
            int pos = req_url.IndexOf("/Reports");
            string current_virtual_path = "";
            if (pos > 0)
            {
                current_virtual_path = req_url.Substring(0, pos);
            }

            this.ReportViewer1.LocalReport.DataSources.Clear();
            this.ReportViewer1.LocalReport.ReportPath = Server.MapPath(@"~/Reports/TJ_DoctorInvoiceCondition.rdlc");
            Microsoft.Reporting.WebForms.ReportParameter vurl = new Microsoft.Reporting.WebForms.ReportParameter("VirtualURL", current_virtual_path);
            this.ReportViewer1.LocalReport.SetParameters(new Microsoft.Reporting.WebForms.ReportParameter[] { vurl });

            I_InvoiceApprovalDALExt dal4 = new I_InvoiceApprovalDALExt();
            DataTable dt7 = dal4.GetPersonInvoiceCondition();
            this.ReportViewer1.LocalReport.DataSources.Add(new ReportDataSource("DataSetForTJ_DoctorInvoiceCondition", dt7));
            this.ReportViewer1.LocalReport.Refresh();

        }

    }
}